package com.easy.controllor;
import com.easy.bean.Order;
import com.easy.service.OrderService;
import com.easy.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/order")
@CrossOrigin
public class OrderControllor {

    @Autowired
    OrderService orderService;

    @PostMapping
    public Result add(@RequestBody Order order) {
        Object obj = orderService.add(order);
        return Result.success(obj);
    }

    @DeleteMapping("/{id}")
    public Result del(@PathVariable("id") String id){
        Object obj = orderService.del(id);
        return Result.success(obj);
    }

    @PutMapping
    public Result edit(@RequestBody Order order){
        Object obj = orderService.edit(order);
        return Result.success(obj);
    }

    @GetMapping("/{id}")
    public Result one(@PathVariable("id") String id){
        Object obj = orderService.one(id);
        return Result.success(obj);
    }







}
